package com.xuecheng.content.feignclient.auth;

import com.xuecheng.auth.model.po.XcUser;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class XcUserClientFactory implements FallbackFactory<XcUserClient> {
    @Override
    public XcUserClient create(Throwable throwable) {
        return new XcUserClient() {
            @Override
            public XcUser saveUser(XcUser user) {
                log.error("调用用户认证管理服务-保存用户信息发生熔断:{}", throwable.toString(),throwable);
                return null;
            }

            @Override
            public XcUser createAccount(Long companyId) {
                log.error("调用用户认证管理服务-创建账号发生熔断:{}", throwable.toString(),throwable);
                return null;
            }
        };
    }
}
